
buildPath = ../../.build/
dependPath = ../../script/depend/

bin:
	cp -f $(dependPath)/u-boot-xlnx/u-boot $(buildPath)/boot/u-boot.elf
	cp -f image.bif $(buildPath)/boot/
	cp -f RunBoot.tcl $(buildPath)/boot/
	cp -f $(buildPath)/Platform/platform_fsbl.elf $(buildPath)/boot/
	cd $(buildPath)/boot && /opt/Xilinx/SDK/2018.1/bin/xsdk -batch -source RunBoot.tcl
   
build:
	cd $(dependPath)/u-boot-xlnx && make ARCH=arm CROSS_COMPILE=/opt/Xilinx/SDK/2018.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf- zynq_zed_config
	cd $(dependPath)/u-boot-xlnx && make ARCH=arm CROSS_COMPILE=/opt/Xilinx/SDK/2018.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-
	make bin

clean:
	cd $(dependPath)/u-boot-xlnx && make clean

remove:
	cd $(dependPath) && rm -rf u-boot-xlnx
	cd $(buildPath)  && rm -rf boot

new:
	make remove
	cd $(dependPath) && tar -xvf u-boot-xlnx-xilinx-v2018.1.tar.gz
	cd $(dependPath)/u-boot-xlnx && patch -p1 < ../../patchs/u-boot-01.patch
	cd $(buildPath)  && mkdir boot
	make build
    
.PHONY:clean
